#!/usr/bin/python
# -*- coding: UTF-8 -*-

import time

print("hello world...")

print("你好，中国！")

# 这是注释撒
if True:
    print("哈哈")
else:
    print("嘿嘿")

# s = raw_input("请输入任意字符：")
# print(s)

# i = input("请输入数字：")
# print(i)

var1 = "hello world"
print(var1[0])
print(var1[1:3])
print(var1[1:])
print(var1 * 2)

# lst = list(["aaa", "bbb", "ccc", "ddd"])
lst = ["aaa", "bbb", "ccc", "ddd"]
print(lst[0])
print(lst[1:3])
print(lst[2:])
print(lst * 2)
print(lst + ["eee", "fff"])

# 无组不允许更新
# ust = ("aaa", "bbb", "ccc", "ddd")
ust = tuple(["aaa", "bbb", "ccc", "ddd"])
print(ust[0])
print(ust[1:3])
print(ust[2:])
print(ust * 2)

# dct = {}
dct = dict()
dct["one"] = "one"
dct[2] = "two"
print(dct)
print(dct[2])

i = 1
if i == 1:
    print(i)
elif i == 2:
    print(i)
elif i == 3:
    print(i)
else:
    print(i)

nums = [12, 9, 14, 13]
even = []
odd = []
print(nums, even, odd)
while len(nums) > 0:
    num = nums.pop();
    if num % 2 == 0:
        even.append(num)
    else:
        odd.append(num)
print(nums, even, odd)

c = 0
while c < 5:
    print(c, "is less than 5")
    c += 1
else:
    print(c, "is big than 5")

for o in "hello":
    print(o)
else:
    print("world")


def formatdate(formatter):
    "格式化时间"
    print(locals())
    print(globals())
    return time.strftime(formatter, time.localtime())

print(formatdate("%Y-%m-%d %H:%M:%S"))

